home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / archive / ntzip.arj / TAILOR.H < prev    next >
C/C++ Source or Header  |  1993-09-30  |  4KB  |  169 lines

  1. /* tailor.h -- Not copyrighted 1991 Mark Adler */
  2.  
  3. /* const's are inconsistently used across ANSI libraries--kill for all
  4.    header files. */
  5. #define const
  6. #define far 
  7. #define near
  8.  
  9. /* Use prototypes and ANSI libraries if __STDC__ */
  10. #ifdef __STDC__
  11. #  ifndef PROTO
  12. #    define PROTO
  13. #  endif /* !PROTO */
  14. #  define MODERN
  15. #endif /* __STDC__ */
  16.  
  17.  
  18. /* Use prototypes and ANSI libraries if Silicon Graphics */
  19. #ifdef sgi
  20. #  ifndef PROTO
  21. #    define PROTO
  22. #  endif /* !PROTO */
  23. #  define MODERN
  24. #endif /* sgi */
  25.  
  26.  
  27. /* Define MSDOS for Turbo C as well as Microsoft C */
  28. #ifdef __POWERC                 /* For Power C too */
  29. #  define __TURBOC__
  30. #endif /* __POWERC */
  31. #ifdef __TURBOC__
  32. #  ifndef MSDOS
  33. #    define MSDOS
  34. #  endif /* !MSDOS */
  35. #endif /* __TURBOC__ */
  36.  
  37.  
  38. /* Use prototypes and ANSI libraries if Microsoft or Borland C */
  39. #ifdef MSDOS
  40. #  ifndef PROTO
  41. #    define PROTO
  42. #  endif /* !PROTO */
  43. #  define MODERN
  44. #endif /* MSDOS */
  45.  
  46.  
  47. #ifdef WIN32
  48. #  include <windows.h>
  49. #endif
  50.  
  51. /* Turn off prototypes if requested */
  52. #ifdef NOPROTO
  53. #  ifdef PROTO
  54. #    undef PROTO
  55. #  endif /* PROTO */
  56. #endif /* NOPROT */
  57.  
  58.  
  59. /* Used to remove arguments in function prototypes for non-ANSI C */
  60. #ifdef PROTO
  61. #  define OF(a) a
  62. #else /* !PROTO */
  63. #  define OF(a) ()
  64. #endif /* ?PROTO */
  65.  
  66.  
  67. /* Allow far and huge allocation for small model (Microsoft C or Turbo C) */
  68. #ifdef MSDOS
  69. #  ifdef __TURBOC__
  70. #    include <alloc.h>
  71. #  else /* !__TURBOC__ */
  72. #    include <malloc.h>
  73. #if !defined (MIPS) && !defined(farmalloc) && !defined(farfree)
  74. #    define farmalloc _fmalloc
  75. #    define farfree   _ffree
  76. #endif
  77. #  endif /* ?__TURBOC__ */
  78. #else /* !MSDOS */
  79. #  define huge
  80. #  define far
  81. #  define near
  82. #  define farmalloc malloc
  83. #  define farfree   free
  84. #endif /* ?MSDOS */
  85.  
  86.  
  87. #ifdef WIN32
  88. #  define farmalloc malloc
  89. #  define farfree   free
  90. #  ifdef MIPS
  91. #    define ffree free
  92. #    define fmalloc malloc
  93. #  endif
  94. #endif
  95.  
  96. /* Define MSVMS if either MSDOS or VMS defined */
  97. #ifdef MSDOS
  98. #  define MSVMS
  99. #else /* !MSDOS */
  100. #  ifdef VMS
  101. #    define MSVMS
  102. #  endif /* VMS */
  103. #endif /* ?MSDOS */
  104.  
  105.  
  106. /* Define void, voidp, and extent (size_t) */
  107. #include <stdio.h>
  108. #ifdef MODERN
  109. #  ifndef M_XENIX
  110. #    include <stddef.h>
  111. #  endif /* !M_XENIX */
  112. #  include <stdlib.h>
  113.    typedef size_t extent;
  114.    typedef void voidp;
  115. #else /* !MODERN */
  116.    typedef unsigned int extent;
  117. #  define void int
  118.    typedef char voidp;
  119. #endif /* ?MODERN */
  120.  
  121. /* Get types and stat */
  122. #ifdef VMS
  123. #  include <types.h>
  124. #  include <stat.h>
  125. #else /* !VMS */
  126. #  include <sys/types.h>
  127. #  include <sys/stat.h>
  128. #endif /* ?VMS */
  129.  
  130.  
  131. /* Cheap fix for unlink on VMS */
  132. #ifdef VMS
  133. #  define unlink delete
  134. #endif /* VMS */
  135.  
  136.  
  137. /* For Pyramid */
  138. #ifdef pyr
  139. #  define strrchr rindex
  140. #  define ZMEM
  141. #endif /* pyr */
  142.  
  143.  
  144. /* File operations--use "b" for binary if allowed */
  145. #ifdef MODERN
  146. #  define FOPR "rb"
  147. #  define FOPM "r+b"
  148. #  define FOPW "w+b"
  149. #else /* !MODERN */
  150. #  define FOPR "r"
  151. #  define FOPM "r+"
  152. #  define FOPW "w+"
  153. #endif /* ?MODERN */
  154.  
  155.  
  156. /* Fine tuning */
  157. #ifndef MSDOS
  158. #   define BSZ 8192   /* Buffer size for files */
  159. #else /* !MSDOS */
  160. #   define BSZ 4096   /* Keep precious NEAR space */
  161.     /* BSZ can't be 8192 even for compact model because of 64K limitation
  162.      * in im_lmat.c. If you run out of memory when processing a large number
  163.      * files, use the compact model and reduce BSZ to 2048 here and in
  164.      * im_lm.asm.
  165.      */
  166. #endif /* ?MSDOS */
  167.  
  168. /* end of tailor.h */
  169.